using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_InterfaceManage : Admin, IRequiresSessionState
{
	protected GridView GridView1;
	public string m_testurl;
	public string m_adminTestUrl;
	private InterfaceBll _interface = null;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected InterfaceBll m_interface
	{
		get
		{
			InterfaceBll @interface;
			if (this._interface == null)
			{
				this._interface = new InterfaceBll(this.conn);
				@interface = this._interface;
			}
			else
			{
				@interface = this._interface;
			}
			return @interface;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(16))
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "Interface");
			base.WriteRightErrMsg();
		}
		string str = this.config["SecurityKey"].ToString();
		string str2 = this.config["AdminSecurityKey"].ToString();
		string str3 = DateTime.Now.ToString("yyyyMMddHH");
		str = this.Md5("testabcdefghijklmnopqrstuvwxyz123456" + str + "Test" + str3, 32);
		this.m_testurl = "?action=Test&username=test&password=abcdefghijklmnopqrstuvwxyz123456&SecurityKey=" + str;
		str2 = this.Md5("testabcdefghijklmnopqrstuvwxyz123456" + str2 + "Test" + str3, 32);
		this.m_adminTestUrl = "?action=Test&username=test&password=abcdefghijklmnopqrstuvwxyz123456&SecurityKey=" + str2;
		this.GridView1.DataSource = this.m_interface.GetInterfaces();
		this.GridView1.DataBind();
	}
	protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		if (e.Row.RowType == DataControlRowType.DataRow)
		{
			e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E7EDFE'");
			e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
		}
		if (e.Row.RowType != DataControlRowType.Header && e.Row.RowType != DataControlRowType.Pager)
		{
			foreach (GridViewRow gridViewRow in this.GridView1.Rows)
			{
				Panel panel = (Panel)gridViewRow.FindControl("SetupSpan");
				LinkButton linkButton = (LinkButton)gridViewRow.FindControl("btnDelete");
				HtmlAnchor htmlAnchor = (HtmlAnchor)gridViewRow.Cells[10].FindControl("UpdateInterface");
				HiddenField hiddenField = (HiddenField)gridViewRow.Cells[10].FindControl("HiddenInterfaceID");
				htmlAnchor.Attributes.Add("onclick", " AddInterface('" + hiddenField.UniqueID + "','Modify');");
				if (!base.admin.CheckAdminPower(18))
				{
					linkButton.Enabled = false;
				}
				if (!base.admin.CheckAdminPower(17))
				{
					panel.Visible = false;
				}
			}
		}
	}
	protected void btnDelete_Command(object sender, CommandEventArgs e)
	{
		this.m_interface.DelInterface(int.Parse(e.CommandName));
		this.GridView1.DataSource = this.m_interface.GetInterfaces();
		this.GridView1.DataBind();
	}
}
